package com.jinhua.medical.manager.service;

import com.jinhua.medical.manager.common.Pager;
import com.jinhua.medical.manager.mybatis.dto.SysChineseMedical;
import com.jinhua.medical.manager.mybatis.dto.SysChineseMedicalExample;
import com.jinhua.medical.manager.mybatis.mapper.SysChineseMedicalMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class MedicalService {

    @Resource
    private SysChineseMedicalMapper  sysChineseMedicalMapper;

    public List findAllMedical(){
        SysChineseMedicalExample sysChineseMedicalExample = new SysChineseMedicalExample();
        return  sysChineseMedicalMapper.selectByExample(sysChineseMedicalExample);
    }

    public void updateMedical(SysChineseMedical sysChineseMedical){
          sysChineseMedicalMapper.updateByPrimaryKeySelective(sysChineseMedical);
    }

    public void medicalList(SysChineseMedical sysChineseMedical, Pager pager){
       List results =  sysChineseMedicalMapper.medicalList(sysChineseMedical,pager);
       pager.setRows(results);
       pager.setRecords(sysChineseMedicalMapper.countMedicalList(sysChineseMedical,pager));
    }
}
